<template>
  <div class="textPage">
    <nav class="navTitle">
      {{ $globalData.titleName }}起重机指挥实操考试自动评判系统
    </nav>
    <section class="questionContant">
      <div v-for="(item, index) in questionArry" :key="index">
        <div
          class="contantInfo"
          v-if="item.type == '1' && currentIndex == index"
        >
          <div class="leftContent">
            <div class="question_title">
              <div class="danxuan">
                <span>{{ item.questionType }}</span> :{{ item.questionName }}
              </div>
            </div>
            <div class="question_info">
              <ul v-if="item.optionA.includes('/')">
                <li v-if="item.optionA">
                  A:
                  <img class="optionImg" :src="'/api' + item.optionA" alt="" />
                  <img
                    v-if="indexOfcheckedOne == '0'"
                    class="rightImg"
                    src="../../assets/textPage/right.png"
                    alt=""
                  />
                  <div class="selectWay">
                    <span @click="magnifyHandle(0, item.type)">放大</span>
                    <span @click="checkedHandle(item.optionA, item.type, '0')">
                      选择
                    </span>
                  </div>
                </li>
                <li v-if="item.optionB">
                  B:
                  <img class="optionImg" :src="'/api' + item.optionB" alt="" />
                  <img
                    v-if="indexOfcheckedOne == '1'"
                    class="rightImg"
                    src="../../assets/textPage/right.png"
                    alt=""
                  />
                  <div class="selectWay">
                    <span @click="magnifyHandle(1, item.type)">放大</span>
                    <span @click="checkedHandle(item.optionB, item.type, '1')">
                      选择
                    </span>
                  </div>
                </li>
                <li v-if="item.optionC">
                  C:
                  <img class="optionImg" :src="'/api' + item.optionC" alt="" />
                  <img
                    v-if="indexOfcheckedOne == '2'"
                    class="rightImg"
                    src="../../assets/textPage/right.png"
                    alt=""
                  />
                  <div class="selectWay">
                    <span @click="magnifyHandle(2, item.type)">放大</span>
                    <span @click="checkedHandle(item.optionC, item.type, '2')">
                      选择
                    </span>
                  </div>
                </li>
                <li v-if="item.optionD">
                  D:
                  <img class="optionImg" :src="'/api' + item.optionD" alt="" />
                  <img
                    v-if="indexOfcheckedOne == '3'"
                    class="rightImg"
                    src="../../assets/textPage/right.png"
                    alt=""
                  />
                  <div class="selectWay">
                    <span @click="magnifyHandle(3, item.type)">放大</span>
                    <span @click="checkedHandle(item.optionD, item.type, '3')">
                      选择
                    </span>
                  </div>
                </li>
                <li v-if="item.optionE">
                  E:
                  <img class="optionImg" :src="'/api' + item.optionE" alt="" />
                  <img
                    v-if="indexOfcheckedOne == '4'"
                    class="rightImg"
                    src="../../assets/textPage/right.png"
                    alt=""
                  />
                  <div class="selectWay">
                    <span @click="magnifyHandle(4, item.type)">放大</span>
                    <span @click="checkedHandle(item.optionE, item.type, '4')">
                      选择
                    </span>
                  </div>
                </li>
              </ul>
              <div v-if="!item.optionA.includes('/')">
                <el-radio-group v-model="radio" @change="radioChange">
                  <el-radio v-if="item.optionA" :label="0">A:{{ item.optionA }}</el-radio>
                  <el-radio v-if="item.optionB" :label="1">B:{{ item.optionB }}</el-radio>
                  <el-radio v-if="item.optionC" :label="2">C:{{ item.optionC }}</el-radio>
                  <el-radio v-if="item.optionD" :label="3">D:{{ item.optionD }}</el-radio>
                </el-radio-group>
              </div>
              <img
                class="questiontitleImg"
                v-if="item.titleImage"
                :src="'/api' + item.titleImage"
                alt=""
              />
              <button
                class="nextQuestion"
                @click="nextQuestion(index, item.type)"
              >
                下一题
              </button>
            </div>
          </div>
          <div class="rightContant">
            <div class="question_type">
              <span>{{ index + 1 }}、单选题</span>
              <span>(共{{ questionArry.length }}题)</span>
            </div>
            <div class="checkedAnswer">已选答案</div>
            <div class="answerImg">
              <img
                v-if="checkedAnswer.includes('/')"
                :src="'/api' + checkedAnswer"
                alt=""
              />
              <div v-if="!checkedAnswer.includes('/')">{{ checkedAnswer }}</div>
            </div>
          </div>
        </div>
        <div
          class="contantInfo"
          v-if="item.type == '2' && currentIndex == index"
        >
          <div class="leftContent">
            <div class="question_title_pd">
              <div class="panduanti">
                <span>{{ item.questionType }}</span> :{{ item.questionName }}
              </div>
            </div>
            <div class="question_info">
              <div class="radio_panduan">
                <p>
                  <el-radio class="acitonButton" v-model="radio2" label="1"
                    >正确</el-radio
                  >
                </p>
                <p>
                  <el-radio class="acitonButton" v-model="radio2" label="2"
                    >错误</el-radio
                  >
                </p>
              </div>
              <img
                class="questiontitleImg"
                v-if="item.titleImage"
                :src="'/api' + item.titleImage"
                alt=""
              />
              <button
                class="nextQuestion"
                @click="nextQuestion(index, item.type)"
              >
                下一题
              </button>
            </div>
          </div>
          <div class="rightContant" v-if="checkedAnswerArray">
            <div class="question_type">
              {{ index + 1 }}、判断题<span
                >(共{{ questionArry.length }}题)</span
              >
            </div>
            <div class="checkedAnswer">已选答案</div>
            <div class="answerImg_duoxuan2" v-if="indexOfcheckedArray">
              {{ radio2 == "1" ? "正确" : radio2 == "2" ? "错误" : "" }}
            </div>
          </div>
        </div>
        <div
          class="contantInfo"
          v-if="item.type == '3' && currentIndex == index"
        >
          <div class="leftContent">
            <div class="question_title">
              <div class="duoxuan">
                <span>{{ item.questionType }}</span> :{{ item.questionName }}
              </div>
            </div>
            <div class="question_info">
              <ul v-if="item.optionA.includes('/')">
                <li class="duoxuan_li" v-if="item.optionA">
                  A:
                  <img class="optionImg" :src="'/api' + item.optionA" alt="" />
                  <img
                    v-if="indexOfcheckedArray.includes('A')"
                    class="rightImg"
                    src="../../assets/textPage/right.png"
                    alt=""
                  />
                  <div class="selectWay">
                    <span @click="magnifyHandle(0)">放大</span>
                    <span @click="checkedHandle(item.optionA, item.type, '0')">
                      {{
                        checkedAnswerArray.includes(item.optionA)
                          ? "取消"
                          : "选择"
                      }}
                    </span>
                  </div>
                </li>
                <li class="duoxuan_li" v-if="item.optionB">
                  B:
                  <img class="optionImg" :src="'/api' + item.optionB" alt="" />
                  <img
                    v-if="indexOfcheckedArray.includes('B')"
                    class="rightImg"
                    src="../../assets/textPage/right.png"
                    alt=""
                  />
                  <div class="selectWay">
                    <span @click="magnifyHandle(1)">放大</span>
                    <span @click="checkedHandle(item.optionB, item.type, '1')">
                      {{
                        checkedAnswerArray.includes(item.optionB)
                          ? "取消"
                          : "选择"
                      }}
                    </span>
                  </div>
                </li>
                <li class="duoxuan_li" v-if="item.optionC">
                  C:
                  <img class="optionImg" :src="'/api' + item.optionC" alt="" />
                  <img
                    v-if="indexOfcheckedArray.includes('C')"
                    class="rightImg"
                    src="../../assets/textPage/right.png"
                    alt=""
                  />
                  <div class="selectWay">
                    <span @click="magnifyHandle(2)">放大</span>
                    <span @click="checkedHandle(item.optionC, item.type, '2')">
                      {{
                        checkedAnswerArray.includes(item.optionC)
                          ? "取消"
                          : "选择"
                      }}
                    </span>
                  </div>
                </li>
                <li class="duoxuan_li" v-if="item.optionD">
                  D:
                  <img class="optionImg" :src="'/api' + item.optionD" alt="" />
                  <img
                    v-if="indexOfcheckedArray.includes('D')"
                    class="rightImg"
                    src="../../assets/textPage/right.png"
                    alt=""
                  />
                  <div class="selectWay">
                    <span @click="magnifyHandle(3)">放大</span>
                    <span @click="checkedHandle(item.optionD, item.type, '3')">
                      {{
                        checkedAnswerArray.includes(item.optionD)
                          ? "取消"
                          : "选择"
                      }}
                    </span>
                  </div>
                </li>
                <li class="duoxuan_li" v-if="item.optionE">
                  E:
                  <img class="optionImg" :src="'/api' + item.optionE" alt="" />
                  <img
                    v-if="indexOfcheckedArray.includes('E')"
                    class="rightImg"
                    src="../../assets/textPage/right.png"
                    alt=""
                  />
                  <div class="selectWay">
                    <span @click="magnifyHandle(4)">放大</span>
                    <span @click="checkedHandle(item.optionE, item.type, '4')">
                      {{
                        checkedAnswerArray.includes(item.optionE)
                          ? "取消"
                          : "选择"
                      }}
                    </span>
                  </div>
                </li>
              </ul>
              <div v-if="!item.optionA.includes('/')">
                <el-checkbox-group
                  v-model="checkList"
                  @change="checkListChange"
                >
                  <el-checkbox v-if="item.optionA" label="A">A:{{ item.optionA }}</el-checkbox>
                  <el-checkbox v-if="item.optionB" label="B">B:{{ item.optionB }}</el-checkbox>
                  <el-checkbox v-if="item.optionC" label="C">C:{{ item.optionC }}</el-checkbox>
                  <el-checkbox v-if="item.optionD" label="D">D:{{ item.optionD }}</el-checkbox>
                  <el-checkbox v-if="item.optionE" label="E">E:{{ item.optionE }}</el-checkbox>
                </el-checkbox-group>
              </div>
              <img
                class="questiontitleImg"
                v-if="item.titleImage"
                :src="'/api' + item.titleImage"
                alt=""
              />
              <button
                class="nextQuestion"
                @click="nextQuestion(index, item.type)"
              >
                下一题
              </button>
            </div>
          </div>
          <div class="rightContant" v-if="checkedAnswerArray">
            <div class="question_type">
              {{ index + 1 }}、多选题<span
                >(共{{ questionArry.length }}题)</span
              >
            </div>
            <div class="checkedAnswer">已选答案</div>
            <div class="answerImg_duoxuan2" v-if="indexOfcheckedArray">
              {{ indexOfcheckedArray2 }}
            </div>
            <div
              class="answerImg_duoxuan"
              v-for="(item, index) in checkedAnswerArray"
              :key="index"
            >
              <img :src="'/api' + item" alt="" />
            </div>
          </div>
        </div>
        <div
          class="contantInfo"
          style="display: block"
          v-if="item.type == '0' && currentIndex == index"
        >
          <div class="duoxuan_title">
            <div class="shicaoti">
              {{ index + 1 }}、 <span>{{ item.questionType }}(实操题)</span> :{{
                item.questionName
              }}
            </div>
          </div>

          <div class="shadow" v-if="showCountFlag">
            开始答题倒计时：
            <div style="color: #1890ff">{{ count }}</div>
          </div>
        </div>
      </div>
      <VideoRtsp v-if="questionType0"></VideoRtsp>
    </section>
    <div class="studentInfo_contant">
      <img
        class="headerImg"
        :src="'data:image/jpeg;base64,' + textStudentInfo.signInImage"
        alt=""
      />
      <ul class="studentInfo">
        <li>
          <div>
            姓名：<span>{{ textStudentInfo.name }}</span>
          </div>
          <div>
            性别：<span>{{
              textStudentInfo.idCard
                ? parseInt(textStudentInfo.idCard.slice(-2, -1)) % 2 === 1
                  ? "男"
                  : "女"
                : "未知"
            }}</span>
          </div>
          <div>
            准考证号：<span>{{ textStudentInfo.examRegistrationNumber }}</span>
          </div>
          <div>
            考试项目：<span>{{ textStudentInfo.projectWork }}</span>
          </div>
          <div>
            项目代号：<span>{{ textStudentInfo.projectCode }}</span>
          </div>
          <div>
            身份证号：<span>{{ textStudentInfo.idCard }}</span>
          </div>
          <div>
            考试时间：<span>{{ textStudentInfo.examDate }}</span>
          </div>
        </li>
      </ul>
    </div>
    <div class="sacalCantant" v-if="showSacalCantant">
      <div>
        <el-carousel
          indicator-position="outside"
          arrow="always"
          :autoplay="false"
          :initial-index="initialIndex"
          @change="change"
          height="400px"
        >
          <el-carousel-item v-for="(item, index) in answerImg" :key="index">
            <img
              style="width: 100%; height: 100%"
              :src="'/api' + item"
              alt=""
            />
          </el-carousel-item>
        </el-carousel>
        <div class="btns">
          <el-button @click="showSacalCantant = false">缩小</el-button>
          <el-button @click="change2">选择</el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import "animate.css";
import VideoRtsp from "../../components/textVideo.vue";
import $api from "../../untils/api";
import { mapState } from "vuex";
import SpeakTts from "speak-tts";
export default {
  name: "textPage",
  components: {
    VideoRtsp,
  },
  data() {
    return {
      currentIndex: 0, //题目类型分类
      currentType: "1", //1单选 2判断 3多选
      questionArry: [], //考试题目

      checkedAnswer: "", //单选题已选答案
      indexOfcheckedOne: "", //单选题已选答案标识
      checkedAnswerArray: [], //多选题已选答案
      indexOfcheckedArray: [], //多选题已选答案标识
      indexOfcheckedArray2: "",
      radio: null,
      checkList: [],
      radio2: "", //判断题已选答案
      answerImg: [], //放大图片数组
      showSacalCantant: false, //放大图片显隐
      initialIndex: 0, //放大图片展示索引
      checkedAnsweIndex: 0, //放大图片选择索引
      count: 3,
      showCountFlag: true,

      actionNumberArr: [],
      actionNum: 0,
      tts: new SpeakTts(),
      questionType0: false,

      questionAnswer: "",
    };
  },
  created() {
    this.getQuestions();
  },

  computed: {
    ...mapState(["examineeId", "textStudentInfo"]),
  },

  methods: {
    //获取考试题目
    getQuestions() {
      if (this.examineeId) {
        $api.getQuestions(this.examineeId).then((res) => {
          if (res.status == "200" && res.data.code == "200") {
            this.questionArry = res.data.data
              .filter((item) => item.type !== "0")
              .concat(res.data.data.filter((item) => item.type === "0"));

            res.data.data.filter((item) => {
              item.type == "0"
                ? this.actionNumberArr.push(item.actionNumber)
                : "";
            });
            const questionItem = this.questionArry[0];
            if (questionItem.type == "1") {
              switch (questionItem.examineeAnswer) {
                case "A":
                  this.radio = 0;
                  this.questionAnswer = "A";
                  this.checkedAnswer = "A";
                  break;
                case "B":
                  this.radio = 1;
                  this.questionAnswer = "B";
                  this.checkedAnswer = "B";
                  break;
                case "C":
                  this.radio = 2;
                  this.questionAnswer = "C";
                  this.checkedAnswer = "C";
                  break;
                case "D":
                  this.radio = 3;
                  this.questionAnswer = "D";
                  this.checkedAnswer = "D";
                  break;
                case null:
                  this.radio = null;
                  this.questionAnswer = null;
                  break;
              }
            }
          }
        });
      }
    },
    radioChange(e) {
      this.indexOfcheckedOne = e.toString();
      switch (e) {
        case 0:
          this.checkedAnswer = "A";
          break;
        case 1:
          this.checkedAnswer = "B";
          break;
        case 2:
          this.checkedAnswer = "C";
          break;
        case 3:
          this.checkedAnswer = "D";
          break;
      }
    },
    //选择答案
    checkedHandle(imgUrl, type, index) {
      if (type == "1") {
        this.checkedAnswer = imgUrl;
        this.indexOfcheckedOne = index;
      }
      if (type == "3") {
        this.checkedAnswerArray.includes(imgUrl)
          ? this.checkedAnswerArray.splice(
              this.checkedAnswerArray.indexOf(imgUrl),
              1
            )
          : this.checkedAnswerArray.push(imgUrl);
        this.paramsHandle(index);
      }
    },
    //放大图片选择答案
    change(index) {
      this.checkedAnsweIndex = index;
    },
    change2() {
      if (this.currentType == "1") {
        this.checkedAnswer == this.answerImg[this.checkedAnsweIndex]
          ? (this.checkedAnswer = "")
          : (this.checkedAnswer = this.answerImg[this.checkedAnsweIndex]);

        this.indexOfcheckedOne = this.checkedAnsweIndex.toString();
      }
      if (this.currentType == "2") {
      }
      if (this.currentType == "3") {
        let result = this.answerImg[this.checkedAnsweIndex];
        this.checkedAnswerArray.includes(result)
          ? this.checkedAnswerArray.splice(
              this.checkedAnswerArray.indexOf(result),
              1
            )
          : this.checkedAnswerArray.push(result);
        this.paramsHandle(this.checkedAnsweIndex);
      }
    },
    //放大图片
    magnifyHandle(number, type) {
      this.checkedAnsweIndex = number;
      this.showSacalCantant = true;
      let result = Object.values(this.questionArry[this.currentIndex]);

      this.answerImg = result.filter((item) => {
        return (
          typeof item === "string" &&
          (item.includes(".png") || item.includes(".jpg"))
        );
      });
      this.initialIndex = number;
    },
    checkListChange(e) {
      this.indexOfcheckedArray = this.checkList;
      this.indexOfcheckedArray2 = this.checkList.sort().join("");
    },
    //下一题并提交答案
    nextQuestion(index, type) {
      let params;
      if (type == "1") {
        switch (this.indexOfcheckedOne) {
          case "0":
            this.questionAnswer = "A";
            break;
          case "1":
            this.questionAnswer = "B";
            break;
          case "2":
            this.questionAnswer = "C";
            break;
          case "3":
            this.questionAnswer = "D";
            break;
        }
        let question = this.questionArry[index];
        params = {
          answer: this.questionAnswer,
          questionId: question.id,
          recordId: question.recordId,
          similarity: question.similarity,
          type: question.type,
        };
      }
      if (type == "2") {
        switch (this.radio2) {
          case "1":
            this.questionAnswer = "0";
            break;
          case "2":
            this.questionAnswer = "1";
            break;
        }
        let question = this.questionArry[index];
        params = {
          answer: this.questionAnswer,
          questionId: question.id,
          recordId: question.recordId,
          similarity: question.similarity,
          type: question.type,
        };
      }
      if (type == "3") {
        let question = this.questionArry[index];
        if (typeof this.indexOfcheckedArray === "string") {
          params = {
            answer: this.indexOfcheckedArray,
            questionId: question.id,
            recordId: question.recordId,
            similarity: question.similarity,
            type: question.type,
          };
        } else {
          params = {
            answer: this.indexOfcheckedArray.join(""),
            questionId: question.id,
            recordId: question.recordId,
            similarity: question.similarity,
            type: question.type,
          };
        }
      }
      this.checkList = [];
      if (params.answer) {
        $api.saveQuestion(params).then((res) => {
          if (res.data.code == "200") {
            Number(this.currentIndex + 1) > Number(this.questionArry.length)
              ? this.$alert("已经是最后一题！", "提示!", {
                  confirmButtonText: "确定",
                  showClose: false,
                })
              : "";
            this.currentIndex += 1;
            this.currentType = this.questionArry[index + 1].type;
            this.checkedAnswer = "";
            this.indexOfcheckedOne = "";
            this.checkedAnswerArray = [];
            this.indexOfcheckedArray = [];
            this.indexOfcheckedArray2 = "";
            this.radio = "";
            const questionItem = this.questionArry[this.currentIndex];
            if (questionItem.type == "1") {
              switch (questionItem.examineeAnswer) {
                case "A":
                  this.radio = 0;
                  this.questionAnswer = "A";
                  this.checkedAnswer = "A";
                  break;
                case "B":
                  this.radio = 1;
                  this.questionAnswer = "B";
                  this.checkedAnswer = "B";
                  break;
                case "C":
                  this.radio = 2;
                  this.questionAnswer = "C";
                  this.checkedAnswer = "C";
                  break;
                case "D":
                  this.radio = 3;
                  this.questionAnswer = "D";
                  this.checkedAnswer = "D";
                  break;
                case null:
                  this.radio = null;
                  this.questionAnswer = null;
                  break;
              }
            }
            if (questionItem.type == "2") {
              switch (questionItem.examineeAnswer) {
                case "0":
                  this.radio2 = "1";
                  this.questionAnswer = "0";
                  break;
                case "1":
                  this.radio2 = "2";
                  this.questionAnswer = "1";
                  break;
                case null:
                  this.radio2 = null;
                  this.questionAnswer = null;
                  break;
              }
            }
            if (questionItem.type == "3") {
              if (questionItem.examineeAnswer) {
                this.checkList = questionItem.examineeAnswer.split("");
                this.indexOfcheckedArray = this.checkList.join("");
                this.indexOfcheckedArray2 = this.indexOfcheckedArray;
              }
            }
            if (this.currentType == "0") {
              this.questionType0 = true;
              this.tts.speak({
                text: "接下来进行实操考试，考生需在十秒内根据题目做出正确动作，每题倒计时三秒后开始，请考生做好准备。",
                queue: false,
                listeners: {
                  onend: () => {
                    this.nextShicao(index);
                    // 可以在mounted钩子中初始化相机，如果需要的话
                  },
                },
              });
            }
          }
        });
      } else {
        this.$alert("请选择答案", "提示!", {
          confirmButtonText: "确定",
          showClose: false,
        });
      }
    },
    nextShicao(index) {
      let question = this.questionArry[index + 1];
      if (question) {
        this.tts.speak({
          text: question.questionName,
          queue: false,
          listeners: {
            onend: () => {
              // 可以在mounted钩子中初始化相机，如果需要的话
            },
          },
        });
      }

      const intervalId = setInterval(() => {
        this.count--;
        if (this.count <= 0) {
          clearInterval(intervalId);
          this.showCountFlag = false;

          const data = {
            mode: "detect",
            poseid_list: this.actionNumberArr,
            poseid: this.actionNumberArr[this.actionNum],
          };

          $api.pose(data).then((res) => {
            if (res.data.info.length < 6) {
              console.log(question, "question1");
              const paramsArr = {
                similarity: res.data.info,
                questionId: question?.id,
                recordId: question.recordId,
                type: question.type,
              };
              $api.saveQuestion(paramsArr).then((res) => {
                if (res.data.code == "200" && res.status == "200") {
                  if (this.questionArry[this.currentIndex + 1].type == "0") {
                    this.currentIndex += 1;
                    this.count = 3;
                    this.actionNum += 1;
                    this.showCountFlag = true;
                    this.a(this.currentIndex);
                  }
                } else {
                  this.a(this.currentIndex);
                }
              });
            }
          });
        }
      }, 1000);
    },

    a(index) {
      let question = this.questionArry[index];
      if (question) {
        this.tts.speak({
          text: question.questionName,
          queue: false,
          listeners: {
            onend: () => {
              // 可以在mounted钩子中初始化相机，如果需要的话
            },
          },
        });
      }
      const intervalId = setInterval(() => {
        this.count--;
        if (this.count <= 0) {
          clearInterval(intervalId);
          this.showCountFlag = false;

          const data = {
            mode: "detect",
            poseid_list: this.actionNumberArr,
            poseid: this.actionNumberArr[this.actionNum],
          };

          $api.pose(data).then((res) => {
            if (res.data.info.length < 6) {
              console.log(question, "question2");
              const paramsArr = {
                similarity: res.data.info,
                questionId: question.id,
                recordId: question.recordId,
                type: question.type,
              };
              $api.saveQuestion(paramsArr).then((res) => {
                if (res.data.code == "200" && res.status == "200") {
                  if (
                    Number(this.currentIndex + 1) >=
                    Number(this.questionArry.length)
                  ) {
                    this.questionType0 = false;
                    this.tts.speak({
                      text: "考试结束，请查看成绩。",
                      queue: false,
                      listeners: {
                        onend: () => {
                          // 可以在mounted钩子中初始化相机，如果需要的话
                        },
                      },
                    });
                    const examineeId = this.$store.state.examineeId;
                    $api
                      .submit({
                        examineeId: examineeId,
                      })
                      .then((res) => {
                        if (res.data.code == "200" && res.status == "200") {
                          this.$router.push({
                            name: "score",
                            params: {
                              score: res.data.data.score,
                            },
                          });
                        }
                      });

                    return;
                  }
                }
                if (this.questionArry[this.currentIndex + 1]?.type == "0") {
                  this.currentIndex += 1;
                  this.count = 3;
                  this.actionNum += 1;
                  this.showCountFlag = true;
                  this.a(this.currentIndex);
                } else {
                  this.currentIndex += 1;
                }
              });
            }
          });
        }
      }, 1000);
    },

    //答案分类
    paramsHandle(params) {
      let result = Number(params);

      switch (result) {
        case 0:
          this.indexOfcheckedArray.includes("A")
            ? this.indexOfcheckedArray.splice(
                this.indexOfcheckedArray.indexOf("A"),
                1
              )
            : this.indexOfcheckedArray.push("A");
          break;
        case 1:
          this.indexOfcheckedArray.includes("B")
            ? this.indexOfcheckedArray.splice(
                this.indexOfcheckedArray.indexOf("B"),
                1
              )
            : this.indexOfcheckedArray.push("B");
          break;
        case 2:
          this.indexOfcheckedArray.includes("C")
            ? this.indexOfcheckedArray.splice(
                this.indexOfcheckedArray.indexOf("C"),
                1
              )
            : this.indexOfcheckedArray.push("C");
          break;
        case 3:
          this.indexOfcheckedArray.includes("D")
            ? this.indexOfcheckedArray.splice(
                this.indexOfcheckedArray.indexOf("D"),
                1
              )
            : this.indexOfcheckedArray.push("D");
          break;
        case 4:
          this.indexOfcheckedArray.includes("E")
            ? this.indexOfcheckedArray.splice(
                this.indexOfcheckedArray.indexOf("E"),
                1
              )
            : this.indexOfcheckedArray.push("E");
          break;
      }
    },
  },
};
</script>

<style scoped>
@import url(../../style/textPage.scss);
</style>
